package com.tiancheng.trade.settlement.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * @author kellen
 * @date 2021/3/30
 */
@Getter
@AllArgsConstructor
public enum CheckSummaryCheckResultEnum {
    ABNORMAL(0, "异常"),
    NORMAL(1, "正常"),
    ;

    private Integer code;
    private String desc;


    public static String getDesc(int code) {
        Optional<CheckSummaryCheckResultEnum> found = Arrays.stream(CheckSummaryCheckResultEnum.values()).filter(c -> c.code.equals(code)).findFirst();
        if (found.isPresent()) {
            return found.get().getDesc();
        }
        return "";
    }
}
